001    /**
002     * Copyright 2003-2004 The Apache Software Foundation
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *     http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package net.dpml.cli;
017    
018    import java.util.List;
019    
020    /**
021     * A CommandLine that detected values and options can be written to.
022     */
023    public interface WriteableCommandLine extends CommandLine
024    {
025        /**
026         * Adds an Option to the CommandLine
027         * @param option the Option to add
028         */
029        void addOption( Option option );
030        
031        /**
032         * Adds a value to an Option in the CommandLine.
033         * @param option the Option to add to
034         * @param value the value to add
035         */
036        void addValue( Option option, Object value );
037    
038        /**
039         * Sets the default values for an Option in the CommandLine
040         * @param option the Option to add to
041         * @param defaultValues the defaults for the option
042         */
043        void setDefaultValues( Option option, List defaultValues );
044        
045        /**
046         * Adds a switch value to an Option in the CommandLine.
047         * @param option the Option to add to
048         * @param value the switch value to add
049         * @throws IllegalStateException if the switch has already been added
050         */
051        void addSwitch( Option option, boolean value ) throws IllegalStateException;
052        
053        /**
054         * Sets the default state for a Switch in the CommandLine.
055         * @param option the Option to add to
056         * @param defaultSwitch the defaults state for ths switch
057         */
058        void setDefaultSwitch( Option option, Boolean defaultSwitch );
059        
060        /**
061         * Adds a property value to a name in the CommandLine.
062         * Replaces any existing value for the property.
063         * 
064         * @param property the name of the property
065         * @param value the value of the property
066         */
067        void addProperty( String property, String value );
068        
069        /**
070         * Detects whether the argument looks like an Option trigger 
071         * @param argument the argument to test
072         * @return true if the argument looks like an Option trigger
073         */
074        boolean looksLikeOption( String argument );
075    }